Class symantec.itools.multimedia.ScrollingText
All Packages Class Hierarchy This Package Previous Next Index
Class symantec.itools.multimedia.ScrollingText
Object
|
+----Component
|
+----Canvas
|
+----symantec.itools.multimedia.ScrollingText
- public class ScrollingText
- extends Canvas
- implements Runnable
Scrolling text component. Forms a text banner that scrolls specified
text horizontally. The component allows multiple messages and links.
- Version:
- 1.0, Feb 2, 1997
- Author:
- Symantec
-
SCROLL_LEFT
- Constant which indicates that the banner should scroll from right to left
-
SCROLL_RIGHT
- Constant which indicates that the banner should scroll from left to right
-
context
- If used in an applet, this is the applet's context.
-
currIndex
- Index of current message text and URL
-
currLinkTo
- Current URL link.
-
currMessage
- Current message text.
-
frame
- Location in browser to show linked HTML pages.
-
hiliteColor
- Color for highlighted text.
-
isMouseOver
- Mouse over message text.
-
lastMouseX
- Last mouse cursor position.
-
lastMouseY
- Last mouse cursor position.
-
linkToList
- URL links which correspond with messages.
-
messageList
- List of messages to scroll across the banner.
-
scrollDirection
- Current scroll direction.
-
scrollThread
- Thread which runs the scrolling animation.
-
scrollUnit
- Distance to scroll on each update.
-
sleepTime
- Controls the speed of the scroll.
-
suspended
- State of scrolling animation.
-
textHeight
- Height of current message text.
-
textImage
- The offscreen buffer to draw in.
-
textWidth
- Width of current message text.
-
textX
- Current horizontal text position.
-
textY
- Current vertical text position.
-
wasMouseOverText
- Status of mouse position.
-
wasStatusMessage
- Previous status message.
-
symantec.itools.multimedia.ScrollingText()
- Construct default scrolling text banner.
-
addNotify()
- Tells this component that it has been added to a container.
-
addPropertyChangeListener(PropertyChangeListener)
- Adds a listener for all event changes.
-
addVetoableChangeListener(VetoableChangeListener)
- Adds a vetoable listener for all event changes.
-
createTextParams()
- Setup metrics information for current message.
-
getFrame()
- Obtain the display location of linked pages.
-
getHiliteColor()
- Obtain the current color for text highlighting
-
getLinkToList()
- Obtain the current set of URL links.
-
getMessageList()
- Obtain the current list of messages.
-
getScrollDirection()
- Obtain the current direction of scrolling.
-
getScrollInterval()
- Obtain the current scroll interval.
-
getScrollUnit()
- Obtain the current size of the scroll step.
-
hide()
- Makes this component invisible.
-
isImageInvalid()
- Returns true if a image has been set, but it is not the
size of this component.
-
isMouseOverText(int, int)
- Determines if the given point is over the current text.
-
nextPos()
- Increment scroll step.
-
paint(Graphics)
- Paints this component using the given graphics context.
-
removeNotify()
- Tells this component that it is being removed from a container.
-
removePropertyChangeListener(PropertyChangeListener)
- Removes a listener for all event changes.
-
removeVetoableChangeListener(VetoableChangeListener)
- Removes a vetoable listener for all event changes.
-
reshape(int, int, int, int)
- Moves and/or resizes this component.
-
run()
- ScrollingText thread body.
-
setAppletContext(AppletContext)
- Specify the current applet context.
-
setFrame(String)
- Specify the display location of linked pages.
-
setHiliteColor(Color)
- Set the highlight color for text.
-
setLinkToList(URL[])
- Specify the list of URLs for message links.
-
setMessageList(String[])
- Specify the current list of messages.
-
setScrollDirection(int)
- Specify the banner's current scroll direction.
-
setScrollInterval(int)
- Set sleep time between scroll steps.
-
setScrollUnit(int)
- Specify the size of each scroll step.
-
show()
- Makes this component visible.
-
startScrollingText()
- Resumes the animation of the scrolling text.
-
stopScrollingText()
- Suspends the animation of the scrolling text.
-
update(Graphics)
- Handles redrawing of this component on the screen.
-
updateCurrentMessage(boolean)
- Move to next message in message list.
-
validate()
- Ensures that this component is laid out properly, as needed.
SCROLL_LEFT
public static final int SCROLL_LEFT
- Constant which indicates that the banner should scroll from right to left
SCROLL_RIGHT
public static final int SCROLL_RIGHT
- Constant which indicates that the banner should scroll from left to right
context
protected transient java.applet.AppletContext context
- If used in an applet, this is the applet's context.
currIndex
protected int currIndex
- Index of current message text and URL
currLinkTo
protected java.net.URL currLinkTo
- Current URL link.
currMessage
protected java.lang.String currMessage
- Current message text.
frame
protected java.lang.String frame
- Location in browser to show linked HTML pages.
Valid values are "_self" to show in the current frame;
"_parent" show in the parent frame;
"_top" show in the topmost frame;
"_blank" show in a new unnamed top-level window;
name show in a new top-level window named name.
hiliteColor
protected java.awt.Color hiliteColor
- Color for highlighted text. Default value is red.
isMouseOver
protected transient boolean isMouseOver
- Mouse over message text.
lastMouseX
protected transient int lastMouseX
- Last mouse cursor position.
lastMouseY
protected transient int lastMouseY
- Last mouse cursor position.
linkToList
protected java.net.URL[] linkToList
- URL links which correspond with messages.
messageList
protected java.lang.String[] messageList
- List of messages to scroll across the banner.
scrollDirection
protected int scrollDirection
- Current scroll direction. Default value SCROLL_LEFT.
scrollThread
protected transient java.lang.Thread scrollThread
- Thread which runs the scrolling animation.
scrollUnit
protected int scrollUnit
- Distance to scroll on each update. Distance is in pixels. Default value 10.
sleepTime
protected int sleepTime
- Controls the speed of the scroll. Default value 150.
suspended
protected transient boolean suspended
- State of scrolling animation.
textHeight
protected transient int textHeight
- Height of current message text.
textImage
protected transient java.awt.Image textImage
- The offscreen buffer to draw in.
textWidth
protected transient int textWidth
- Width of current message text.
textX
protected transient int textX
- Current horizontal text position.
textY
protected transient int textY
- Current vertical text position.
wasMouseOverText
protected transient boolean wasMouseOverText
- Status of mouse position.
wasStatusMessage
protected transient java.lang.String wasStatusMessage
- Previous status message.
ScrollingText
public ScrollingText()
- Construct default scrolling text banner.
addNotify
public synchronized void addNotify()
- Tells this component that it has been added to a container.
This is a standard Java AWT method which gets called by the AWT when
this component is added to a container. Typically, it is used to
create this component's peer.
It has been overridden here to start the scrolling text thread.
- Overrides:
- addNotify in class Canvas
- See Also:
- removeNotify
addPropertyChangeListener
public void addPropertyChangeListener(PropertyChangeListener listener)
- Adds a listener for all event changes.
- Parameters:
- PropertyChangeListener - listener the listener to add.
- See Also:
- removePropertyChangeListener
addVetoableChangeListener
public void addVetoableChangeListener(VetoableChangeListener listener)
- Adds a vetoable listener for all event changes.
- Parameters:
- VetoableChangeListener - listener the listener to add.
- See Also:
- removeVetoableChangeListener
createTextParams
protected void createTextParams()
- Setup metrics information for current message. Sets textX, textY, textHeight and textWidth.
getFrame
public java.lang.String getFrame()
- Obtain the display location of linked pages. If the ScrollingText is in an applet this
method returns where the linked pages are displayed.
- Returns:
- Place to display the linked documents.
Valid values are "_self" to show in the current frame;
"_parent" show in the parent frame;
"_top" show in the topmost frame;
"_blank" show in a new unnamed top-level window;
show in a new top-level window named name
getHiliteColor
public java.awt.Color getHiliteColor()
- Obtain the current color for text highlighting
- Returns:
- current highlight color
getLinkToList
public java.net.URL[] getLinkToList()
- Obtain the current set of URL links.
- Returns:
- list of URL links. Each URL corresponds to the message of the same index in the message list
getMessageList
public java.lang.String[] getMessageList()
- Obtain the current list of messages.
- Returns:
- the current list of messages being displayed
getScrollDirection
public int getScrollDirection()
- Obtain the current direction of scrolling.
- Returns:
- the current direction, either SCROLL_LEFT or SCROLL_RIGHT
getScrollInterval
public int getScrollInterval()
- Obtain the current scroll interval. This is the number of milliseconds
that the scroll thread will sleep between scroll steps.
- Returns:
- current scroll delay setting, in milliseconds
getScrollUnit
public int getScrollUnit()
- Obtain the current size of the scroll step.
- Returns:
- the number of pixels that text moves on each scroll step
hide
public synchronized void hide()
- Makes this component invisible.
This is a standard Java AWT method which gets called to hide
this component. A hidden component cannot be seen by the user nor
does it take up space in its container, but it does continue to
exist.
- Overrides:
- hide in class Component
- See Also:
- show
isImageInvalid
protected boolean isImageInvalid()
- Returns true if a image has been set, but it is not the
size of this component.
isMouseOverText
protected boolean isMouseOverText(int x,
int y)
- Determines if the given point is over the current text.
- Parameters:
- x - horizontal location of point
- y - vertical location of point
- Returns:
- true if given point is over the current text
nextPos
protected synchronized void nextPos()
- Increment scroll step. Moves to next message as needed. Not usually called directly.
paint
public void paint(Graphics g)
- Paints this component using the given graphics context.
This is a standard Java AWT method which typically gets called
by the AWT to handle painting this component. It paints this component
using the given graphics context. The graphics context clipping region
is set to the bounding rectangle of this component and its <0,0>
coordinate is this component's top-left corner.
- Parameters:
- g - the graphics context used for painting
- Overrides:
- paint in class Canvas
- See Also:
- repaint, update
removeNotify
public synchronized void removeNotify()
- Tells this component that it is being removed from a container.
This is a standard Java AWT method which gets called by the AWT when
this component is removed from a container. Typically, it is used to
destroy the peers of this component and all its subcomponents.
It has been overridden here to stop the scrolling text thread.
- Overrides:
- removeNotify in class Component
- See Also:
- addNotify
removePropertyChangeListener
public void removePropertyChangeListener(PropertyChangeListener listener)
- Removes a listener for all event changes.
- Parameters:
- PropertyChangeListener - listener the listener to remove.
- See Also:
- addPropertyChangeListener
removeVetoableChangeListener
public void removeVetoableChangeListener(VetoableChangeListener listener)
- Removes a vetoable listener for all event changes.
- Parameters:
- VetoableChangeListener - listener the listener to remove.
- See Also:
- addVetoableChangeListener
reshape
public synchronized void reshape(int x,
int y,
int width,
int height)
- Moves and/or resizes this component.
This is a standard Java AWT method which gets called to move and/or
resize this component. Components that are in containers with layout
managers should not call this method, but rely on the layout manager
instead.
- Parameters:
- x - horizontal position in the parent's coordinate space
- y - vertical position in the parent's coordinate space
- width - the new width
- height - the new height
- Overrides:
- reshape in class Component
run
public void run()
- ScrollingText thread body. This method is called by the Java virtual
machine to when this thread starts.
setAppletContext
protected void setAppletContext(AppletContext c)
- Specify the current applet context.
- Parameters:
- c - new applet context
setFrame
public void setFrame(String newFrame) throws PropertyVetoException
- Specify the display location of linked pages. If the ScrollingText is in an applet this
method determines where the linked pages are displayed.
- Parameters:
- newFrame - where to display the linked documents.
Valid values are "_self" to show in the current frame;
"_parent" show in the parent frame;
"_top" show in the topmost frame;
"_blank" show in a new unnamed top-level window;
show in a new top-level window named name
- Throws: PropertyVetoException
- if the specified property value is unacceptable
setHiliteColor
public void setHiliteColor(Color newHiliteColor) throws PropertyVetoException
- Set the highlight color for text. Text is highlighted in this color when the mouse cursor is over
it and it contains a non-null link.
- Parameters:
- newHiliteColor - color for highlighted text.
- Throws: PropertyVetoException
- if the specified property value is unacceptable
setLinkToList
public void setLinkToList(URL[] list) throws PropertyVetoException
- Specify the list of URLs for message links.
Each link corresponds with a message in the message list.
If a message has no link, a null URL should be included for that message.
- Parameters:
- list - list of URL links
- Throws: PropertyVetoException
- if the specified property value is unacceptable
setMessageList
public void setMessageList(String[] list) throws PropertyVetoException
- Specify the current list of messages. These messages scroll sequentially
through the banner.
- Parameters:
- list - list of messages to display
- Throws: PropertyVetoException
- if the specified property value is unacceptable
setScrollDirection
public void setScrollDirection(int dir) throws PropertyVetoException
- Specify the banner's current scroll direction.
- Parameters:
- dir - direction to scroll. Valid values are SCROLL_LEFT and SCROLL_RIGHT
- Throws: PropertyVetoException
- if the specified property value is unacceptable
setScrollInterval
public void setScrollInterval(int speed) throws PropertyVetoException
- Set sleep time between scroll steps. This function controls
the speed of scrolling. A lower number indicates a faster speed.
- Parameters:
- speed - number of milliseconds to sleep between scroll steps. The smaller the
number the faster the scroll. Minimum value of 30.
- Throws: PropertyVetoException
- if the specified property value is unacceptable
setScrollUnit
public void setScrollUnit(int unit) throws PropertyVetoException
- Specify the size of each scroll step.
- Parameters:
- unit - the number of pixels to move the text on each scroll step
- Throws: PropertyVetoException
- if the specified property value is unacceptable
show
public synchronized void show()
- Makes this component visible.
This is a standard Java AWT method which gets called to show this
component. If this component was invisible due to a previous hide()
call it make this component visible again.
- Overrides:
- show in class Component
- See Also:
- hide
startScrollingText
public void startScrollingText()
- Resumes the animation of the scrolling text.
stopScrollingText
public void stopScrollingText()
- Suspends the animation of the scrolling text.
update
public void update(Graphics g)
- Handles redrawing of this component on the screen.
This is a standard Java AWT method which gets called by the Java
AWT (repaint()) to handle repainting this component on the screen.
The graphics context clipping region is set to the bounding rectangle
of this component and its <0,0> coordinate is this component's
top-left corner.
Typically this method paints the background color to clear the
component's drawing space, sets graphics context to be the foreground
color, and then calls paint() to draw the component.
It is overridden here to reduce flicker by eliminating the uneeded
clearing of the background.
- Parameters:
- g - the graphics context
- Overrides:
- update in class Component
- See Also:
- repaint, paint
updateCurrentMessage
protected void updateCurrentMessage(boolean next)
- Move to next message in message list. Not usually called directly.
- Parameters:
- next - if true, move to next message; otherwise reset message with current index
validate
public void validate()
- Ensures that this component is laid out properly, as needed.
This is a standard Java AWT method which gets called by the AWT to
make sure this component and its subcomponents have a valid layout.
If this component was made invalid with a call to invalidate(), then
it is laid out again.
It is overridden here to also find the containing applet at validation time.
- Overrides:
- validate in class Component
- See Also:
- invalidate
All Packages Class Hierarchy This Package Previous Next Index